#include "APP.h"
#include "Encoder.h"
#include "LED.H"
float unit = 0;

void task_7() _task_ task_Encoder
{
	static char keyd_V_value = -1, keyd_I_value = -1;
	char press_stat = 0;
	encoder_init();
	while(1)
	{
		
		press_stat = encoder_press_value();
		
		if(press_stat == 0)
		{	
			keyd_V_value++;
//			keyd_V_value = ((keyd_V_value >3 ) ? keyd_V_value++ : 0);
			if(keyd_V_value >3)
			{
				 keyd_V_value = 0;
			}
		}
		
		switch(keyd_V_value)
		{
			case 0: unit += encoder_rotate_value() / 100;
				break;
			case 1: unit += encoder_rotate_value() / 10;
				break;
			case 2: unit += encoder_rotate_value();
				break;
			case 3: unit += encoder_rotate_value() * 10;
				break;
		}
		
		unit = (unit >= 18) ? 18 : unit;
		unit = (unit <=  0) ?  0 : unit;
		os_wait2(K_TMO,5);
	}
		
	
}
	
